﻿using AiXiu.Model;
using AiXiu.Model.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AiXiu.IBLL
{
    public interface IUserManager
    {
        /// <summary>
        /// 注册用户
        /// </summary>
        /// <param name="tBLogins">登录信息</param>
        /// <returns></returns>
        OperResult Reg(TBLogins tBLogins);

        /// <summary>
        /// 通过用户名登录
        /// </summary>
        /// <param name="usrtName">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        OperResult<TBUsers> LoginByUserName(string usrtName,string password);

        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        OperResult<TBUsers> GetUser(int userId);

        /// <summary>
        /// 通过手机号登录
        /// </summary>
        /// <param name="mobile">手机号</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        OperResult<TBUsers> LoginByMobile(string mobile, string password);

        /// <summary>
        /// 更新除头像外其他个人信息
        /// </summary>
        /// <param name="users"></param>
        /// <returns></returns>
        OperResult<TBUsers> EditwithoutAvatar(TBUsers users);

        /// <summary>
        /// 更新用户头像
        /// </summary>
        /// <param name="users"></param>
        /// <returns></returns>
        OperResult<TBUsers> EditAvatar(TBUsers users);

        /// <summary>
        /// 待上传视频
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="fileName">文件名</param>
        /// <param name="headline">标题</param>
        /// <param name="location">位置</param>
        /// <returns></returns>
        OperResult<CreateUploadVideoResult> ToBeUpload(int userId, string fileName, string headline, string location = null);

        /// <summary>
        /// 更新视频 返回本次更新的数量
        /// </summary>
        /// <returns></returns>
        int UpdateVideos();

        /// <summary>
        /// 根据用户id获取视频列表
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        OperResult<List<TBVideos>> GetVideosid(int userId);

        /// <summary>
        /// 根据视频Id删除视频
        /// </summary>
        /// <param name="videoId"></param>
        void DeleteVideo(string videoId);

        /// <summary>
        /// 查询可播放视频列表
        /// </summary>
        /// <returns></returns>
        List<TBVideos> GetVideos();

        /// <summary>
        /// 通过视频id获取视频信息
        /// </summary>
        /// <param name="videoId">视频id</param>
        /// <returns>本地数据库视频信息</returns>
        TBVideos GetVideoByVideoId(string videoId);

        /// <summary>
        /// 初始化播放
        /// </summary>
        /// <param name="videoId">视频id</param>
        /// <returns>阿里云视频信息</returns>
        GetPlayInfoResult InitPlay(string videoId);

        #region 视频点赞

        /// <summary>
        /// 是否已点赞
        /// </summary>
        /// <param name="videoId">视频id</param>
        /// <param name="userId">用户id</param>
        /// <returns></returns>
        bool IsLike(string videoId, int userId);

        /// <summary>
        /// 添加点赞
        /// </summary>
        /// <param name="videoId">视频id</param>
        /// <param name="userId">用户id</param>
        /// <returns></returns>
        bool AddLike(string videoId, int userId);

        /// <summary>
        /// 移除点赞
        /// </summary>
        /// <param name="videoId">视频id</param>
        /// <param name="userId">用户id</param>
        /// <returns></returns>
        bool RemoveLike(string videoId, int userId);

        /// <summary>
        /// 显示点赞总数
        /// </summary>
        /// <param name="videoId">视频id</param>
        /// <returns></returns>
        long Count(string videoId);

        #endregion

        #region 视频评论

        /// <summary>
        /// 添加评论
        /// </summary>
        /// <param name="videoId">视频id</param>
        /// <param name="discuss">评论</param>
        /// <returns></returns>
        bool Add(string videoId, Discuss discuss);

        /// <summary>
        /// 评论计数
        /// </summary>
        /// <param name="videoId"></param>
        /// <returns></returns>
        long Pcount(string videoId);

        /// <summary>
        /// 查询评论列表
        /// </summary>
        /// <param name="videoId"></param>
        /// <param name="pageNumber"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        List<Discuss> QueryDiscusses(string videoId, int pageNumber, int pageSize = 10);

        #endregion

        #region 社交业务管理接口

        /// <summary>
        /// 添加好友
        /// </summary>
        /// <param name="selfId">自己的用户Id</param>
        /// <param name="otherId">对方的用户Id</param>
        /// <returns></returns>
        bool AddFriend(int selfId, int otherId);

        /// <summary>
        /// 获取好友列表
        /// </summary>
        /// <param name="selfId">自己的用户Id</param>
        /// <returns></returns>
        Dictionary<int, Friend> GetFriends(int selfId);

        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="selfId">自己的用户Id</param>
        /// <param name="otherId">对方的用户Id</param>
        /// <param name="content">消息内容</param>
        /// <returns></returns>
        bool SendMessage(int selfId, int otherId, string content);

        /// <summary>
        /// 获取好友信息
        /// </summary>
        /// <param name="selfId">自己的用户Id</param>
        /// <param name="otherId">对方的用户Id</param>
        /// <returns></returns>
        Friend GetFriend(int selfId, int otherId);

        /// <summary>
        /// 获取消息记录
        /// </summary>
        /// <param name="selfId">自己的用户Id</param>
        /// <param name="otherId">对方的用户Id</param>
        /// <param name="pageNumber"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        List<Message> GetMessages(int selfId, int otherId, int pageNumber, int pageSize = 10);

        /// <summary>
        /// 是否是好友
        /// </summary>
        /// <param name="selfId">自己的用户Id</param>
        /// <param name="otherId">对方的用户Id</param>
        /// <returns></returns>
        bool IsFriend(int selfId, int otherId);

        #endregion
    }

}
